﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;


public class QueryString
{
    public static string DogrulamaKodu
    {
        get
        {

            if (HttpContext.Current.Request.QueryString["Id"] == null)
            {
                return "";
            }

            string result = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["Id"]);
            result = result.Replace("'", "''");
            return result;
        }
    }

    public static int Urun
    {
        get
        {
            //if (HttpContext.Current.Request.QueryString["UrunId"] == null)
            //{
            //    return -1;
            //}

            //return int.Parse(HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["UrunId"]));
            if (((Page)HttpContext.Current.Handler).RouteData.Values["UrunId"] == null)
            {
                return -1;
            }

            return int.Parse(HttpContext.Current.Server.UrlDecode(((Page)HttpContext.Current.Handler).RouteData.Values["UrunId"].ToString()));
        }
    }

    public static int MetinTip
    {
        get
        {
            //if (HttpContext.Current.Request.QueryString["UrunId"] == null)
            //{
            //    return -1;
            //}

            //return int.Parse(HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["UrunId"]));
            if (((Page)HttpContext.Current.Handler).RouteData.Values["MetinTip"] == null)
            {
                return -1;
            }

            return int.Parse(HttpContext.Current.Server.UrlDecode(((Page)HttpContext.Current.Handler).RouteData.Values["MetinTip"].ToString()));
        }
    }

    public static string UrunAdi
    {
        get
        {
            //if (HttpContext.Current.Request.QueryString["UrunId"] == null)
            //{
            //    return -1;
            //}

            //return int.Parse(HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["UrunId"]));
            if (((Page)HttpContext.Current.Handler).RouteData.Values["UrunAdi"] == null)
            {
                return "";
            }

            return HttpContext.Current.Server.UrlDecode(((Page)HttpContext.Current.Handler).RouteData.Values["UrunAdi"].ToString());
        }
    }

    public static int Cikis
    {
        get
        {
            if (((Page)HttpContext.Current.Handler).RouteData.Values["Cikis"] == null)
            {
                return -1;
            }

            return int.Parse(HttpContext.Current.Server.UrlDecode(((Page)HttpContext.Current.Handler).RouteData.Values["Cikis"].ToString()));
            //if (HttpContext.Current.Request.QueryString["Cikis"] == null)
            //{
            //    return -1;
            //}

            //return int.Parse(HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["Cikis"]));
        }
    }

    public static int Kategori
    {
        get
        {

            if (HttpContext.Current.Request.QueryString["KategoriId"] == null)
            {
                return -1;
            }

            return int.Parse(HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["KategoriId"]));
        }
    }
}